# This Makefile should recompile everything, on any change
# This is because there is only one cpp file
# Not a generic makefile
# Copyright 2008, Christopher Diggins http://www.cdiggins.com


#
# Build type selection
#

DEBUG = -g
RELEASE = -O3
BUILDTYPE = $(DEBUG) 

#
# Flag variables used by G++ for linking or compiling
#

CFLAGS = -Wall -c $(BUILDTYPE)
LFLAGS = -Wall $(BUILDTPE)

#
# Input files
#

PROGRAM = cvml.exe
CPPFILES := main.cpp
OBJFILES := $(CPPFILES:.cpp=.o)
HPPFILES := $(wildcard *.hpp) $(wildcard YARD/grammars/*.hpp) $(wildcard YARD/include/*.hpp)

#
# Actions
#

LINK = $(CXX) $(LFLAGS) $(OBJFILES) -o $(PROGRAM) 
COMPILE = $(CXX) $(CFLAGS) $< -o $@

#
# Rules
#

$(PROGRAM) : $(OBJFILES) 
	$(LINK)

$(OBJFILES): %.o: %.cpp $(HPPFILES)
	$(COMPILE)

clean:
	\rm *.o $(PROGRAM)

